import Blockly from 'blockly/core'
import 'blockly/python_compressed'
import 'blockly/blockly_compressed'
import 'blockly/blocks_compressed'

Blockly.Blocks.input_function = {
  init: function () {
    this.appendValueInput('VALUE')
      .setCheck(null)
      .setAlign(Blockly.ALIGN_RIGHT)
      .appendField('input')
    this.setInputsInline(true)
    this.setOutput(true, null)
    this.setColour(105)
    this.setTooltip('')
    this.setHelpUrl('')
  }
}

Blockly.Python.input_function = function (block) {
  const inputValue = Blockly.Python.valueToCode(
    block,
    'VALUE',
    Blockly.Python.ORDER_NONE
  )
  let code = ''
  code = 'input(' + inputValue + ')'
  return [code, Blockly.Python.ORDER_NONE]
}

export default Blockly
